package components.powerups;

import images.GameImagesMap;

import components.ball.NormalBall;
import components.ball.PlayingBallState;
import components.gamelevels.GameLevel;
import components.paddle.LargePaddle;

public class PowerUpResolver {

	private GameLevel level;

	public PowerUpResolver(GameLevel aLevel){
		this.level = aLevel;
	}
	
	public void setLevel(GameLevel level) {
		this.level = level;
	}

	public GameLevel getLevel() {
		return level;
	}
	
	public void runPowerUp(PowerUp power){
		power.doEffect(this);
	}
	
	////////////////////// EFFECTS /////////////////////////////////
	
	public void largePaddle(){
		this.getLevel().replacePaddle(new LargePaddle(0, 0, GameImagesMap.getImage("largepaddle")));
	}
	public void tripleBalls(){
		NormalBall cBall, ball1, ball2;
		cBall = this.getLevel().getBall();
		ball1 = new NormalBall(cBall.getX(), cBall.getY(), cBall);
		ball1.setDirVectorX(-1);
		ball1.setDirVectorY(-2);
		ball1.setState(new PlayingBallState(ball1));
		
		ball2 = new NormalBall(cBall.getX(), cBall.getY(), cBall);
		ball2.setDirVectorX(-3);
		ball2.setDirVectorY(-1);
		ball2.setState(new PlayingBallState(ball2));
		
		this.getLevel().addBall(ball1);
		this.getLevel().addBall(ball2);
	}
	
}
